//
//  BaseViewController.m
//  SnacksOfChina
//
//  Created by qianfeng on 15/9/14.
//  Copyright (c) 2015年 AD Wang. All rights reserved.
//

#import "BaseViewController.h"
#import "AWFactory.h"

@interface BaseViewController ()

@end

@implementation BaseViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    //[self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"btn_navigationBar"] forBarMetrics:UIBarMetricsDefault];
    //self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"LaunchImage-700-Portrait~ipad"]];
}

- (void)addTitleViewWithName:(NSString *)name
{
    UILabel * label = [AWFactory creatLabelWithFrame:CGRectMake(0, 0, 150, 30) text:name];
    label.textColor = [UIColor whiteColor];
    label.textAlignment = NSTextAlignmentCenter;
    //设置自己的视图标题
    self.navigationItem.titleView = label;
}

- (void)addItemsWithCustomViews:(NSArray *)arr isLeft:(BOOL)isLeft
{
    NSMutableArray * items = [[NSMutableArray alloc] init];
    for (UIView * view in arr) {
        UIBarButtonItem * item = [[UIBarButtonItem alloc] initWithCustomView:view];
        [items addObject:item];
    }
    //判断
    if (isLeft) {
        self.navigationItem.leftBarButtonItems = items;
    }else
    {
        self.navigationItem.rightBarButtonItems = items;
    }
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
